package mt.client.GUI;


import mt.*;
import mt.client.*;
import mt.comm.ClientComm;


import java.awt.*;
import javax.swing.*;

public class ClientGUI extends JFrame implements MicroTraderClient {
	private JTextField txtQuantity;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ClientGUI frame = new ClientGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		
	}

	/**
	 * Create the frame.
	 */
	public ClientGUI() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 689, 546);

		
		// MENU BAR

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
			// CONNECTIVITY
		JMenu mnConnectivity = new JMenu("Connectivity");
		menuBar.add(mnConnectivity);
				// FIND SERVERS
		JMenuItem mntmdFindServers = new JMenuItem("Find Servers");
		mnConnectivity.add(mntmdFindServers);
				// DISCONNECT
		JMenuItem mntmDisconnect = new JMenuItem("Disconnect");
		mnConnectivity.add(mntmDisconnect);
			// PROFILE
		JMenu mnProfile = new JMenu("Profile");
		menuBar.add(mnProfile);
				// ORDER HISTORY
		JMenuItem mntmOrderHistory = new JMenuItem("Order History");
		mnProfile.add(mntmOrderHistory);

		
		
		
		// DISPLAY

		JPanel panelDisplay = new JPanel();
		getContentPane().add(panelDisplay, BorderLayout.CENTER);
		panelDisplay.setLayout(new GridLayout(0, 1, 0, 0));
		
			// SELL

		JPanel panelSell = new JPanel();
		panelDisplay.add(panelSell);
		panelSell.setLayout(new BorderLayout(0, 0));
				// LABEL
		JLabel lblSell = new JLabel("Sell");
		lblSell.setHorizontalAlignment(JLabel.CENTER);
		panelSell.add(lblSell, BorderLayout.NORTH);
				// LISTA
		JList<StockResume> listPaneSell = new JList<StockResume>();
		JScrollPane scrollPaneSell = new JScrollPane(listPaneSell);
		panelSell.add(scrollPaneSell, BorderLayout.CENTER);
		
			// BUY

		JPanel panelBuy = new JPanel();
		panelDisplay.add(panelBuy);
		panelBuy.setLayout(new BorderLayout(0, 0));
				// LABEL
		JLabel lblBuy = new JLabel("Buy");
		lblBuy.setHorizontalAlignment(JLabel.CENTER);
		panelBuy.add(lblBuy, BorderLayout.NORTH);
				// LISTA
		JList<StockResume> listPaneBuy = new JList<StockResume>();
		JScrollPane scrollPaneBuy = new JScrollPane(listPaneBuy);
		panelBuy.add(scrollPaneBuy, BorderLayout.CENTER);
		
		
		// STOCK DETAILS PANEL
		
		JPanel panelStockDetails = new JPanel();
		getContentPane().add(panelStockDetails, BorderLayout.EAST);
		panelStockDetails.setLayout(new BorderLayout(0, 0));

		JLabel lblStockDetails = new JLabel("Stock Details");
		panelStockDetails.add(lblStockDetails, BorderLayout.NORTH);

		JList<Order> listPaneStockDetails = new JList<Order>();
		JScrollPane scrollPaneStockDetails = new JScrollPane(listPaneStockDetails);
		panelStockDetails.add(scrollPaneStockDetails, BorderLayout.CENTER);

		
		// CONTROLS

		JPanel panelControl = new JPanel();
		panelStockDetails.add(panelControl, BorderLayout.SOUTH);
		panelControl.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

		JButton btnPlaceOrder = new JButton("Place Order");
		panelControl.add(btnPlaceOrder);

		JTextField txtQuantity_1 = new JTextField();
		txtQuantity_1.setText("Quantity");
		panelControl.add(txtQuantity_1);

	}

	@Override
	public void start(ClientComm clientComm) {
		// TODO Auto-generated method stub

	}
	
	
	
	
	
	
	
	
	
	
	
}
